//
//  PublishLabelViewCell.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/3/7.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

class PublishLabelViewCell: UITableViewCell {
    
    func configure(for indexPath: IndexPath, vm: PublishViewModel) {
//        splitLine.isHidden = indexPath.row == titles.count - 1
        if indexPath.section == 0 {
            if indexPath.row == 1 {
                arrowView.isHidden = true
                titleLabel.text = "费用"
                descLabel.textColor = UIColor(hex: "#F54C4C")
                descLabel.text = "￥\(vm.cost)"
            } else if indexPath.row == 2 {
                arrowView.isHidden = false
                titleLabel.text = "远程门诊日期"
                descLabel.text = vm.reserveTime
            }
        } else if indexPath.section == 1 {
            if indexPath.row == 0 {
                titleLabel.text = "就诊人"
                descLabel.text = vm.patientId.isEmpty ? "请先选择就诊人" : vm.patientName
                descLabel.textColor = vm.patientId.isEmpty ? .textLight : .textDark
            } else {
                titleLabel.text = "预约时段"
                descLabel.text = vm.scheduleTime
            }
        } else {
            titleLabel.text = "是否过敏史"
//            descLabel.text = vm.patientName
        }
    }
    
    func updateData(vm: MyCloudDetailViewModel, indexPath: IndexPath) {
        self.isUserInteractionEnabled = false
        if indexPath.section == 0 {
            if indexPath.row == 1 {
                arrowView.isHidden = true
                titleLabel.text = "费用"
                descLabel.textColor = UIColor(hex: "#F54C4C")
                descLabel.text = "￥\(vm.orderAmount)"
            } else if indexPath.row == 2 {
                arrowView.isHidden = false
                titleLabel.text = "远程门诊日期"
                descLabel.text = vm.scheduleDate + "  " + vm.amPm
            }
        } else if indexPath.section == 1 {
            if indexPath.row == 0 {
                titleLabel.text = "就诊人"
                descLabel.text = vm.patientName
            } else {
                titleLabel.text = "预约时段"
                descLabel.text = vm.scheduleTime
            }
        } else {
            titleLabel.text = "是否过敏史"
//            descLabel.text = vm.patientName
        }
    }
    
    func configure(with vm: MyAdvisoryOrderRowViewModel,
                   patientDetail detailVm: AdvisoryDetailViewModel,
                   indexPath: IndexPath) {
        if indexPath.section == 0 {
            arrowView.isHidden = true
            titleLabel.text = "费用"
            descLabel.textColor = UIColor(hex: "#F54C4C")
            descLabel.text = "￥\(vm.orderAmount)"
        } else if indexPath.section == 1 {
            titleLabel.text = "就诊人"
            descLabel.text = detailVm.patientName
            descLabel.textColor = .textDark
        }
    }
    func configure(indexPath: IndexPath,vm: PublishViewModel,isNurse:Bool) {
        if indexPath.section == 0 {
            arrowView.isHidden = true
            titleLabel.text = "费用"
            descLabel.textColor = UIColor(hex: "#F54C4C")
            descLabel.text = "限时免费"
        } else if indexPath.section == 1 {
            titleLabel.text = "就诊人"
            descLabel.text = vm.patientId.isEmpty ? "请先选择就诊人" : vm.patientName
            descLabel.textColor = vm.patientId.isEmpty ? .textLight : .textDark
        }
    }
    
    
    
    @IBOutlet private weak var titleLabel: UILabel!
    
    @IBOutlet private weak var descLabel: UILabel!
    
    @IBOutlet private weak var arrowView: UIImageView!
    
}
